package sepe.chenli.unit4.task4_3;

import java.util.Date;
import java.util.Scanner;

public class HireUserTest {
    public HireUser inutHireUserInfo() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入客户ID:");
        int userID = sc.nextInt();
        System.out.println("请输入求租客户姓名：");
        String userName = sc.next();
        System.out.println("请输入求租客性别：");
        String sexStr = sc.next();
        char sex = sexStr.charAt(0);
        System.out.println("请输入求租客户电话：");
        String phone = sc.next();
        System.out.println("请输入求租客户接听电话：");
        String homephone = sc.next();
        System.out.println("请输入求租客户邮箱：");
        String email = sc.next();
        System.out.println("请输入求租客户qq：");
        String qq = sc.next();
        System.out.println("请输入求租客户身份证号码：");
        String cardID = sc.next();
        System.out.println("请输入求租客户编号：");
        String hirePersonNo = sc.next();
        Date recordDate = new Date();
        HireUser hireUser=new HireUser();
        hireUser.setUserID(userID);
        hireUser.setUserName(userName);
        hireUser.setSex(sex);
        hireUser.setPhone(phone);
        hireUser.setHomePhone(homephone);
        hireUser.setEmail(email);
        hireUser.setQq(qq);
        hireUser.setCardID(cardID);
        hireUser.setHirePersonNo(hirePersonNo);
        hireUser.setRecordDate(recordDate);
        return  hireUser;
    }
    public static void main(String[] args, int userID) {
        HireUserTest ht = new HireUserTest();
        System.out.println("添加求租客信息：");
        HireUser hireUser = ht.inutHireUserInfo();
        HireUserDAOImp hireUserDAOImp = new HireUserDAOImp();
        boolean isExist = HireUserDAOImp.isExist(hireUser, userID);
        if (isExist) {
            System.out.println("你输入错误，该用户不存在");
        } else {
            hireUserDAOImp.insertUser(hireUser);
            System.out.println("停机求租客户信息成功！");
        }
    }
}
